//
//  MovieCanViewController.m
//  UI_豆瓣项目
//
//  Created by dllo on 15/11/3.
//  Copyright (c) 2015年 关业达. All rights reserved.
//

#import "MovieCanViewController.h"
#import "MovieListSameViewController.h"
#import "MoveListViewController.h"

@interface MovieCanViewController ()

@property (nonatomic, assign)BOOL isSelected;

@property (nonatomic, retain)MoveListViewController *movieListVC;

@property (nonatomic, retain)MovieListSameViewController *movieSameVC;


@end

@implementation MovieCanViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"btn_nav_collection@2x.png"] style:UIBarButtonItemStylePlain target:self action:@selector(rightAction:)] autorelease];
    
    
    self.isSelected =NO;
    
    self.movieListVC = [[MoveListViewController alloc] init];
    [self addChildViewController:self.movieListVC];
    [self.view addSubview:self.movieListVC.view];
    [_movieListVC release];
    
    self.movieSameVC = [[MovieListSameViewController alloc] init];
    [self addChildViewController:self.movieSameVC];
    [self.view addSubview:self.movieSameVC.view];
    [_movieSameVC release];
    
    
    
}

- (void)rightAction:(UIButton *)btn;
{
    if (self.isSelected == NO) {
        // 动画效果
        [UIView transitionFromView:self.movieListVC toView:self.movieSameVC duration:0.5 options:UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) {
            
            
        }];
    }else{
        [UIView transitionFromView:self.movieSameVC toView:self.movieListVC duration:0.5 options:UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) {
            
            
        }];
    }
    
    self.isSelected = !self.isSelected;
    
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
